package com.baidu.mapapi;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;

class b extends BroadcastReceiver
{
  public void onReceive(Context paramContext, Intent paramIntent)
  {
    int i;
    WifiManager localWifiManager = (WifiManager)paramContext.getSystemService("wifi");
    ConnectivityManager localConnectivityManager = (ConnectivityManager)paramContext.getSystemService("connectivity");
    NetworkInfo localNetworkInfo1 = localConnectivityManager.getActiveNetworkInfo();
    NetworkInfo localNetworkInfo2 = localConnectivityManager.getNetworkInfo(0);
    if (localNetworkInfo1 != null)
      if ((localWifiManager.getWifiState() == 3) && ("WIFI".matches(localNetworkInfo1.getTypeName())))
        i = 1;
    while (true)
    {
      while (true)
      {
        while (true)
        {
          while (true)
          {
            Mj.m = i;
            if (-1 != Mj.m)
              Mj.changeGprsConnect();
            return;
            i = 0;
          }
          if (localNetworkInfo2 != null)
            break;
          i = -1;
        }
        if ((localWifiManager.getWifiState() != 3) || (!("WIFI".matches(localNetworkInfo2.getTypeName()))))
          break;
        i = 1;
      }
      i = 0;
    }
  }
}